﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Cisoft.Booking.Model;
using Cisoft.Booking.BLL;

public partial class Business_OrderDetail : WebUI.Page.BasePage
{
    private RuleMO ruleMO = new RuleMO();
    private RuleBO ruleBO = new RuleBO();
    private ShortMessageBO smBO = new ShortMessageBO();
    private ShortMessageMO smMO = new ShortMessageMO();
    private SetBO sBO = new SetBO();
    private SetMO sMO = new SetMO();
    private OrderBO oBO = new OrderBO();
    private OrderMO oMO = new OrderMO();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            FillModel();
        }
    }

    #region 返回事件
    /// <summary>
    /// 返回事件
    /// </summary>
    protected void butrReset_Click(object sender, ImageClickEventArgs e)
    {
        //Response.Redirect("Orders.aspx");
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"","history.go(-2)",true);
    }
    #endregion

    #region 获得规则标识 int GetSMSID()
    /// <summary>
    /// 获得规则标识
    /// </summary>
    private int GetOrderID()
    {
        int id = 0;
        if (Request.QueryString["OrderID"] != null)
        {
            id = int.Parse(Request.QueryString["OrderID"].ToString());
        }

        return id;
    }
    #endregion

    #region 填充页面表格 void FillModel()
    /// <summary>
    /// 填充页面表格
    /// </summary>
    private void FillModel()
    {
        int id = GetOrderID();
        if (id > 0)
        {
            oMO = oBO.GetModel(id);

            switch (oMO.OrderType)
            { 
                case "DC":
                    lbl_Type.Text = "订餐";
                    break;
                case "YD":
                    lbl_Type.Text = "预定包厢";
                    break;
            }
            lbl_ShortMessageSend.Text = oMO.OrderMan;
            lbl_SendTime.Text = Convert.ToDateTime(oMO.OrderTime).GetDateTimeFormats('f')[0].ToString();
            lbl_Content.Text = oMO.OrderContent;
            lbl_UseTime.Text = Convert.ToDateTime(oMO.UseTime).GetDateTimeFormats('f')[0].ToString();
            switch (oMO.OrderStatus)
            { 
                case "1":
                    lbl_Status.Text = "<span style='color:red;font-weight:bold;'>员工已取消预定</span>";
                    break;
                case "-1":
                    break;
                case "0":
                    lbl_Status.Text = "<span style='color:red;font-weight:bold;'>已过期</span>";
                    break;
                case "":
                    lbl_Status.Text = "<span style='color:green;font-weight:bold;'>有效</span>";
                    break;
            }
        }
        else
        {
            PageError("系统不存在该短信！", "Orders.aspx");
        }
    }
    #endregion

}
